package xyz.poke.business.tool.convert;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import xyz.poke.business.tool.common.PageResult;
import xyz.poke.business.tool.entity.Category;
import xyz.poke.business.tool.vo.CategoryVo;

/**
 * @author 迫壳
 * @date 2024/3/17 21:28
 */
@Mapper(componentModel = "spring")
public interface CategoryConvert {

    CategoryConvert INSTANCE = Mappers.getMapper(CategoryConvert.class);

    @Mappings(value = {
            @Mapping(source = "source.pidName", target = "fatherCategoryName")
    })
    CategoryVo to(Category source);

    PageResult<CategoryVo> to(PageResult<Category> source);
}
